package com.example.practice.service.impl;

import com.example.practice.entity.Collect;
import com.example.practice.dao.CollectDao;
import com.example.practice.service.CollectService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Collect)表服务实现类
 *
 * @author makejava
 * @since 2024-01-08 10:34:13
 */
@Service("collectService")
public class CollectServiceImpl implements CollectService {
    @Resource
    private CollectDao collectDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public List<Collect> queryById(Integer id) {
        return this.collectDao.queryById(id);
    }


    /**
     * 新增数据
     *
     * @return 实例对象
     */
    @Override
    public Integer insert(Integer uid, Integer aid) {
        return this.collectDao.insert(uid,aid);
    }

    @Override
    public Collect update(Collect collect) {
        return null;
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.collectDao.deleteById(id) > 0;
    }
}
